# -*- coding: utf-8 -*-
# @Time     : 2020/8/1 17:21

import asyncio
import time

now = lambda: time.time()


async def func(a):
    print(f"python{a} --> {now()}")
    return f"PYTHON{a} --> {now()}"


if __name__ == '__main__':
    # 把多个协程任务装到一个列表中
    tasks = [func(a) for a in range(10)]

    # 创建事件循环对象
    loop = asyncio.get_event_loop()
    # 开启事件循环(启动列表中的协程任务(异步执行))
    loop.run_until_complete(asyncio.wait(tasks))
